package com.travel.modules.sys.controller;

import com.travel.commons.utils.PageUtils;
import com.travel.commons.utils.R;
import com.travel.modules.sys.service.SysLogService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/sys/log")
public class SysLogController {
    @Resource
    private SysLogService sysLogService;

    @RequestMapping("/list")
    private R list(@RequestBody Map<String, Object> param) {
        Integer page = (Integer) param.get("page");
        Integer limit = (Integer) param.get("limit");
        if (page == null || limit == null) {
            return R.error("缺少分页参数");
        }
        return R.ok().put("page", PageUtils.getPage(sysLogService.getLogList(param), limit, page));
    }
}
